class object:
	"""This class is a manipulator for import object"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, prefix='x_', developer='_', project='_', name='_', src=None, dest=None, inter=None, fields_src=[[]], fields_dest=[[]], name_src='', name_dest='', query_src='', query_dest=''):
		self.prefix=prefix
		self.developer=developer
		self.project=project
		self.name=name
		self.src=src
		self.dest=dest
		self.inter=inter
		self.fields_src=fields_src
		self.fields_dest=fields_dest
		self.name_src=name_src
		self.name_dest=name_dest
		self.query_src=query_src
		self.query_dest=query_dest

	def columns(self, fields):
		columns=[]
		for list in fields[1:]:
			columns+=[list[0]]
		return columns

	#end of class object suite

class src_tb:
	"""This class is a manipulator for source table"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, name_src=self.name_src, src=self.src, ):
		self.name=name_src
		self.atable=src.atable()
		self.atable.name=self.name

	def _countself(self):
		return self.atable.countself()
		
	def _select(self, columns=[], clause=[]):
		return self.atable.select(columns, clause)
		
	def _count(self, clause=[]):
		return self.atable.count(clause)

		#end of class src_tb suite

class src_vw:
	"""This class is a manipulator for source view"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.prefix+self.object.developer+self.object.project+self.object.name+self.object.name_src
		self.fields=self.object.columns(self.object.fields_src)
		self.query=self.object.query_src
		self.aview=self.object.src.aview()
		self.aview.name=self.name
		self.aview.fields=self.fields
		self.aview.query=self.query
	
	def _countself(self):
		return self.aview.countself()
		
	def _create(self):
		return self.aview.create()
		
	def _drop(self):
		return self.aview.drop()
	
	def _select(self, columns=[], clause=[]):
		return self.aview.select(columns, clause)
	
	def _count(self, clause=[]):
		return self.aview.count(clause)

	#end of class src_vw suite

class dest_tb:
	"""This class is a manipulator for destination table"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.name_dest
		self.atable=self.object.dest.atable()
		self.atable.name=self.name
	
	def __countself(self):
		return self.atable.countself()
		
	def __select(self, columns=[], clause=[]):
		return self.atable.select(columns, clause)
		
	def _count(self, clause=[]):
		return self.atable.count(clause)
		
	def _delete(self, clause=[]):
		return self.atable.delete(clause)

	def _update(self, dict, clause=[]):
		return self.atable.update(dict, clause)

	def _insert(self, fields, values):
		return self.atable.insert(fields, values)

	#end of class dest_tb suite

class dest_vw:
	"""This class is a manipulator for destination view"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.prefix+self.object.developer+self.object.project+self.object.name+self.object.name_dest
		self.fields=self.object.columns(self.object.fields_dest)
		self.query=self.object.query_dest
		self.aview=self.object.dest.aview()
		self.aview.name=self.name
		self.aview.fields=self.fields
		self.aview.query=self.query
	
	def _countself(self):
		return self.aview.countself()
		
	def _create(self):
		return self.aview.create()
		
	def _drop(self):
		return self.aview.drop()
	
	def _select(self, columns=[], clause=[]):
		return self.aview.select(columns, clause)
	
	def _count(self, clause=[]):
		return self.aview.count(clause)

	#end of class dest_vw suite

class inter_src:
	"""This class is a manipulator for source in intermediate db"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.prefix+self.object.developer+self.object.project+self.object.name+'_src'
		self.fields=self.object.fields_src
		self.primary=self.fields[0][0]
		self.comment='inter_src'
		self.atable=self.object.inter.atable()
		self.atable.name=self.name
		self.atable.fields=self.fields
		self.atable.primary=self.primary
		self.atable.comment=self.comment

	def _countself(self):
		return self.atable.countself()
	
	def _create(self):
		return self.atable.create()
		
	def _drop(self):
		return self.atable.drop()

	def _select(self, columns=[], clause=[]):
		return self.atable.select(columns, clause)
		
	def _count(self, clause=[]):
		return self.atable.count(clause)
		
	def _delete(self, clause=[]):
		return self.atable.delete(clause)

	def _update(self, dict, clause=[]):
		return self.atable.update(dict, clause)

	def _insert(self, fields, values):
		return self.atable.insert(fields, values)

	#end of class inter_src suite

class inter_dest:
	"""This class is a manipulator for destination in intermediate db"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.prefix+self.object.developer+self.object.project+self.object.name+'_dest'
		self.fields=self.object.fields_dest
		self.primary=self.fields[0][0]
		self.comment='inter_dest'
		self.atable=self.object.inter.atable()
		self.atable.name=self.name
		self.atable.fields=self.fields
		self.atable.primary=self.primary
		self.atable.comment=self.comment
	
	def _countself(self):
		return self.atable.countself()
	
	def _create(self):
		return self.atable.create()
		
	def _drop(self):
		return self.atable.drop()

	def _select(self, columns=[], clause=[]):
		return self.atable.select(columns, clause)
		
	def _count(self, clause=[]):
		return self.atable.count(clause)
		
	def _delete(self, clause=[]):
		return self.atable.delete(clause)

	def _update(self, dict, clause=[]):
		return self.atable.update(dict, clause)

	def _insert(self, fields, values):
		return self.atable.insert(fields, values)

	#end of class inter_dest suite

class inter_map:
	"""This class is a manipulator for map in intermediate db"""
	#print (self.__doc__)
	#beginning of class suite
	def __init__(self, object):
		self.object=object
		self.name=self.object.prefix+self.object.developer+self.object.project+self.object.name+'_map'
		self.fields=[object.fields_src[0]]+object.fields_src[1:]+object.fields_dest[1:]
		self.primary=self.fields[0][0]
		self.comment='inter_map'
		self.atable=self.object.inter.atable()
		self.atable.name=self.name
		self.atable.fields=self.fields
		self.atable.primary=self.primary
		self.atable.comment=self.comment
	
	def _countself(self):
		return self.atable.countself()
	
	def _create(self):
		return self.atable.create()
		
	def _drop(self):
		return self.atable.drop()

	def _select(self, columns=[], clause=[]):
		return self.atable.select(columns, clause)
			
	def _count(self, clause=[]):
		return self.atable.count(clause)
			
	def _delete(self, clause=[]):
		return self.atable.delete(clause)

	def _update(self, dict, clause=[]):
		return self.atable.update(dict, clause)

	def _insert(self, fields, values):
		return self.atable.insert(fields, values)
	
	#end of class inter_map suite